<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
    <c:set var="ctx" value="${pageContext.request.contextPath}" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="renderer" content="webkit">
    <title>业务数据流程权限关系</title>
    <jsp:include page="../../import.jsp" flush="true" />
    <script type="text/javascript" src="<%=path %>/resource/lib/plugins/ajaxfileupload.js"></script>
</head>
<sys:funcAuth resCd="isSpeModify">
    <span id="isSpeModify" />
</sys:funcAuth>
<body class="iframeBody">

<div class="Wrapper">
<div id="pageInTab" class="pageInTab">
    <div tabid="tabA" title="基本信息" lselected="true">
    <form id="formSet1">
        <div class="fieldset1 tabel_col clearFix">
                <div class="fieldBox col_100_auto">
                    <div class="label" style="width: auto;">经销商可支持特殊业务类型</div>
                    <div class="field col_66_auto" style="padding-left: 180px">
                        <input id="ALL" type="checkbox" value="ALL" name="ALL" onchange="allChange();"
                               <c:if test="${isModify!=1 }">readonly="readonly"</c:if>><span>全选</span><br/>
                        <c:forEach items="${propMap}" var="kv" begin="0" step="1">
                            <c:if test="${kv.key == 7}">
                                <c:if test="${isShowBigCustomer == 1}">
                                    <input id="prop${kv.key }" type="checkbox" value="${kv.key }" name="prop"
                                           onchange="propChange();"
                                           <c:if test="${isModify!=1 }">readonly="readonly"</c:if>>
                                    <span>${kv.value }
                                    </span><br/>
                                </c:if>
                            </c:if>
                            <c:if test="${kv.key != 7}">
                                <input id="prop${kv.key }" type="checkbox" value="${kv.key }" name="prop"
                                       onchange="propChange();"
                                       <c:if test="${isModify!=1 }">readonly="readonly"</c:if>>
                                <span>${kv.value }
                                </span><br/>
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
            </div>
        <div class="fieldset1 tabel_col clearFix" id="mes">
            <div class="fieldBox col_66">
                <div class="label">供应商渠道担保等级</div>
                <div class="field">
                    <select name="levelCd" id="levelCd" data-value=" ">
                        <option value=" " checked >请选择</option>
                        <option value="1">一级</option>
                        <option value="2">二级</option>
                        <option value="3">网联店</option>
                        <option value="99">其他</option>
                    </select>
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_100_auto">
                <div class="label">渠道担保协议有效期</div>
                <div class="field">
                    <input width="20px" name="validTmStar" id="validTmStar" type="text" class="ui-datepicker" >
                    -
                    <input width="20px" name="validTmEnd" id="validTmEnd" type="text" class="ui-datepicker" >
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="form_view">
                <form id="searchBar">
                    <div class="fieldset1 clearFix">
                        <div class="sqPanel_body">
                            <div class="fieldBox col_100_auto">
                                <div class="label">代偿担保挂靠公司</div>
                                <div class="field">
                                    <input name="lnkCompNm" id="lnkCompNm" type="text"/>
                                    <span id="clearBtn" class="sq-button sq-button-round" onclick="clearLnkComp();">清空</span>
                                </div>
                            </div>
                            <div class="fieldBox">
                                <div class="field">
                                    <input name="guarLnkCompId" id="guarLnkCompId" type="hidden"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <c:if test="${isApply == 1}">
                <div class="fieldBox col_66">
                    <div class="label">公路车【首期】比例</div>
                    <div class="field" style="width: 100%;">
                        <input name="roadBicycleRate" id="roadBicycleRate" type="text" class="ui-textbox" validate="{number:true}" ><span>%</span>
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_66">
                    <div class="label">工程车【首期】比例</div>
                    <div class="field" style="width: 100%;">
                        <input name="stopTruckRate" id="stopTruckRate" type="text" class="ui-textbox" validate="{number:true}"><span>%</span>
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
            </c:if>
            <%-- 供应商准入流程信审审核节点显示 --%>
            <c:if test="${isCreditReviewNode == 1}">
                <div class="fieldBox col_66">
                    <div class="label">一期授信额度</div>
                    <div class="field" style="width: 100%;">
                        <input name="phaseOneCrAmt" id="phaseOneCrAmt" type="text" class="ui-textbox" validate="{number:true}" >
                    </div>
                </div>
                <div class="fieldBox col_66" id="chnLastYearSlAmtLabel">
                    <div class="label">渠道上年销售量</div>
                    <div class="field" style="width: 100%;">
                        <input name="chnLastYearSlAmt" id="chnLastYearSlAmt" type="text" class="ui-textbox" validate="{number:true}" >
                    </div>
                </div>
                <div class="fieldBox col_66" id="chnLnkAmtLabel">
                    <div class="label">渠道挂靠量</div>
                    <div class="field" style="width: 100%;">
                        <input name="chnLnkAmt" id="chnLnkAmt" type="text" class="ui-textbox" validate="{number:true}" >
                    </div>
                </div>
            </c:if>
            <div class="fieldset1 tabel_col tabel_col_s clearFix">
                <div class="sqPanel_body">
                    <div id="fileCfgGrid" class="sq-grid"></div>
                </div>
            </div>
        </div>
        <div class="fieldset1 tabel_col clearFix" id="mes2">
            <div class="fieldBox col_66">
                <div class="label">经销商类型</div>
                <div class="field">
                    <select name="prjLvlCd" id="prjLvlCd" data-value=" ">
                        <option value=" " checked >请选择</option>
                        <option value="01">4S店</option>
                        <option value="02">一级经销商</option>
                        <option value="03">二级经销商</option>
                        <option value="99">其他</option>
                    </select>
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldset1 tabel_col tabel_col_s clearFix">
                <div class="btnsBox inLC">
                    <span id="spl_rl_add_btn" class="sq-button sq-button-round" onclick="packageAddBtnEvent();">添加套餐</span>
                </div>
                <div class="sqPanel_body">
                    <div id="splPackageInfoGrid" class="sq-grid"></div>
                </div>
            </div>
            <div class="fieldset1 tabel_col tabel_col_s clearFix">
                <div class="sqPanel_body">
                    <div id="fileCfgGrid2" class="sq-grid"></div>
                </div>
            </div>
        </div>
        <div class="btnsBox" id="btnsBox" style="text-align: center">
            <c:if test="${isModify == 1 || isCreditReviewNode == 1 }">
                <span id="saveBtn1" class="sq-button sq-button-round" onclick="add();">保存</span>
            </c:if>
        </div>
    </form>
    </div>
</div>
</div>

<script type="text/javascript">
    var isFlow = '${isFlow}';
    var _splId = '${splId}';
    var isModify = '${isModify}';
    var _id = '${id}';
    var _isApply = '${isApply}';
    var _noStartFlow = '${noStartFlow}';
    var _needCloseTab = '${needCloseTab}';
    var fileCfgGrid = null;
    var fileCfgGrid2 = null;
    var isCreditReviewNode = '${isCreditReviewNode}'

    var carsGuarId = '';
    //代偿担保
    var _cfgSysCd = '${cfgSysCd}'; //附件系统CODE
    var _cfgOrgCd = '${cfgOrgCd}'; //附件组织架构
    var _tabNm = '${tabNm}'; //附件对应表
    var _cfgCd = '${cfgCd}'; //附件CODE
    var _modulePath = '${modulePath}';
    var _costomerPath = '${costomerPath}';
    var _rootPath = '${rootPath}';
    var _uploadSysCd = '${uploadSysCd}';
    //大客户业务
    var _cfgSysCd2 = '${cfgSysCd2}'; //附件系统CODE
    var _cfgOrgCd2 = '${cfgOrgCd2}'; //附件组织架构
    var _tabNm2 = '${tabNm2}'; //附件对应表
    var _cfgCd2 = '${cfgCd2}'; //附件CODE
    var _modulePath2 = '${modulePath2}';
    var _costomerPath2 = '${costomerPath2}';
    var _rootPath2 = '${rootPath2}';
    var _uploadSysCd2 = '${uploadSysCd2}';

    var _isModify = '${isModify}';
    var _isSpePow = '${isSpePow}';
    var _mdfFile = '${mdfFile}';

    var _isShowBigCustomer = '${isShowBigCustomer}';
    $(function(){
        $("#formSet1").ligerForm({
            validate : true
        });
        $("#formSet1").ligerForm();
        initData();
        //$("#mes").attr("display","none");
        $("#mes").css("display", 'none');
        $("#mes2").css("display", 'none');
        if ($('#isSpeModify').length > 0) {
            $('#btnsBox').attr("display", "block");
        }else{
            $('#btnsBox').attr("display", "none");
        }
        if(_isModify != 1){
            disableFiled();
        }
        fileCfgGrid = $("#fileCfgGrid").ligerGrid({
            url: '<%=path%>/spl/spepow/initCarsGuarFiles.do?cfgCd='+_cfgCd +'&tabNm='+_tabNm +"&cfgSysCd="+_cfgSysCd+'&cfgOrgCd='+_cfgOrgCd+'&uploadSysCd='+_uploadSysCd,
            parms:{dataId:_id},
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function (rowdata, rowindex, value) {
                        var mustSymbol = '<span class="requiredSymbol">*</span>';
                        if (rowdata.isMust == 1) {
                            return value + mustSymbol;
                        } else {
                            return value;
                        }
                    }
                },
                {display: '上传文件名称', name: 'fileNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传文件路径', name: 'filePath',align: 'left', minWidth: 100,hide:true},
                {display: '上传文件明细', name: 'cfgDtlCd',align: 'left', minWidth: 100,hide:true},
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
                {display: '操作', name: '', minWidth: 200,align: 'left',  enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(_isApply && _isApply == 1){
                            if(_mdfFile){
                                if(_mdfFile == 1){
                                    if(rowdata.audStsCd !=1){
                                        if(rowdata.fileId) {
                                            h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delFile(event,' + rowdata.fileId + ',' + rowindex + ');"><i class="sqBtnIco_7"></i>删除</a>';
                                        }else{
                                            h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile(event,' + rowindex +','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                                        }
                                    }
                                }
                            }else{
                                h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',1);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',2);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                            }
                        }else{
                            if(_mdfFile != 0) {
                                if (!rowdata.audStsCd || rowdata.audStsCd != 1) {
                                    if (rowdata.fileId) {
                                        h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delFile(event,' + rowdata.fileId + ',' + rowindex + ');"><i class="sqBtnIco_7"></i>删除</a>';
                                    } else {
                                        h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile(event,' + rowindex + ',' + rowdata.cfgDtlCd + ');"><i class="sqBtnIco_7"></i>删除</a>';
                                    }
                                }
                            }
                        }
                        return h;
                    }
                },
                {display: '上传', name: 'uploadNm', width: 80,align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(_isApply){
                            if(_mdfFile&&_mdfFile ==1){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+_cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+_cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+_cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+_cfgOrgCd+'\')"></span>';
                            }
                        }else{
                            if(_isModify)
                            h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+_cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+_cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                ' class="fileupload-input" onchange="onChangefile_multi(event,\''+_cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+_cfgOrgCd+'\')"></span>';
                        }
                            return h;
                    }
                },
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function ()
            {
                $('#fileCfgGrid').rowspan('datNm');
                $('#fileCfgGrid').rowspan('uploadNm');
            },
            onSuccess : function(data,grid){
                upload_result_params = [];
                var uploadJOSN = JSON.parse(JSON.stringify(data.rows));
                console.log("uploadJOSN =s= " + JSON.stringify(uploadJOSN));
                for (var i=0; i< uploadJOSN.length; i++){
                    if (StringUtils.isNotEmpty(uploadJOSN[i].fileNm)) {
                        upload_result_params.push(uploadJOSN[i]);
                    }
                }
                console.log("upload_result_params =s= " + JSON.stringify(upload_result_params));

            },
        });
        fileCfgGrid2 = $("#fileCfgGrid2").ligerGrid({
            url: '<%=path%>/spl/spepow/initCarsGuarFiles.do?cfgCd='+_cfgCd2 +'&tabNm='+_tabNm2 +"&cfgSysCd="+_cfgSysCd2+'&cfgOrgCd='+_cfgOrgCd2+'&uploadSysCd='+_uploadSysCd2,
            parms:{dataId:_splId},
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function (rowdata, rowindex, value) {
                        var mustSymbol = '<span class="requiredSymbol">*</span>';
                        if (rowdata.isMust == 1) {
                            return value + mustSymbol;
                        } else {
                            return value;
                        }
                    }
                },
                {display: '上传文件名称', name: 'fileNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传文件路径', name: 'filePath',align: 'left', minWidth: 100,hide:true},
                {display: '上传文件明细', name: 'cfgDtlCd',align: 'left', minWidth: 100,hide:true},
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
                {display: '操作', name: '', minWidth: 200,align: 'left',  enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(_isApply && _isApply == 1){
                            if(_mdfFile){
                                if(_mdfFile == 1){
                                    if(rowdata.audStsCd !=1){
                                        if(rowdata.fileId) {
                                            h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delFile2(event,' + rowdata.fileId + ',' + rowindex + ');"><i class="sqBtnIco_7"></i>删除</a>';
                                        }else{
                                            h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile2(event,' + rowindex +','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                                        }
                                    }
                                }
                            }else{
                                h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',1);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',2);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                            }
                        }else{
                            if(_mdfFile != 0){
                            if(!rowdata.audStsCd || rowdata.audStsCd !=1){
                                if(rowdata.fileId) {
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delFile2(event,' + rowdata.fileId + ',' + rowindex + ');"><i class="sqBtnIco_7"></i>删除</a>';
                                }else{
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile2(event,' + rowindex +','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                                }
                            }
                            }
                        }
                        return h;
                    }
                },
                {display: '上传', name: 'uploadNm', width: 80,align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(_isApply){
                            if(_mdfFile&&_mdfFile ==1){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+_cfgCd2+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+_cfgCd2+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi2(event,\''+_cfgCd2+'\',\''+rowdata.cfgDtlCd+'\',\''+_cfgOrgCd2+'\')"></span>';
                            }
                        }else{
                            if(_isModify)
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+_cfgCd2+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+_cfgCd2+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi2(event,\''+_cfgCd2+'\',\''+rowdata.cfgDtlCd+'\',\''+_cfgOrgCd2+'\')"></span>';
                        }
                        return h;
                    }
                },
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function ()
            {
                $('#fileCfgGrid2').rowspan('datNm');
                $('#fileCfgGrid2').rowspan('uploadNm');
            },
            onSuccess : function(data,grid){
                upload_result_params2 = [];
                var uploadJOSN = JSON.parse(JSON.stringify(data.rows));
                console.log("uploadJOSN =s= " + JSON.stringify(uploadJOSN));
                for (var i=0; i< uploadJOSN.length; i++){
                    if (StringUtils.isNotEmpty(uploadJOSN[i].fileNm)) {
                        upload_result_params2.push(uploadJOSN[i]);
                    }
                }
                console.log("upload_result_params2 =s= " + JSON.stringify(upload_result_params2));

            },
        });

        //初始化主要人员信息
        let _sId = 0;
        splPackageInfoGrid = $("#ligergrid_A1").ligerGrid({
            url: '<%=path%>/product/splRlPsn/initList.do?',
            method : 'get',
            parms:{splId:_sId},
            async: false,
            columns: [
                {
                    display: '套餐名称', name: 'splPackageNm', width: 150, editor: {type: 'text'},
                    validate: function (value,rowData,col) {
                        if (StringUtils.isEmpty(value)) return "此项为必填项！";
                    }
                },
                {
                    display: '首期比例', name: 'splPackageFirstPct', width: 150, editor: {type: 'text'},
                    validate: function (value,rowData,col) {
                        if (StringUtils.isEmpty(value)) return "此项为必填项！";
                    }
                },
                {
                    display: '客户保证金比例', name: 'splPackageDepositPct', width: 150, editor: {type: 'text'},
                    validate: function (value,rowData,col) {
                        if (StringUtils.isEmpty(value)) return "此项为必填项！";
                    }
                },
                {
                    display: 'IRR', name: 'splPackageIrr', width: 150, editor: {type: 'text'},
                    validate: function (value,rowData,col) {
                        if (StringUtils.isEmpty(value)) return "此项为必填项！";
                    }
                },
                { display: '操作', minWidth: 80 , align:'left',
                    render: function (rowdata, rowindex, value){
                        var d = "";
                        if(rowdata.hsjPsnId == null){
                            if(rowdata.id){
                                d='<a class="sq-button-hasicon" href="javascript:deleteDB(';
                                d+="'"+rowdata.__id+"'";
                                d+=",'"+rowdata.id+"'";
                                d+=')"><i class="sqBtnIco_7"></i>删除</a>';
                            }else{
                                d='<a class="sq-button-hasicon" href="javascript:deletePage(';
                                d+="'"+rowdata.__id+"'";
                                d+=')"><i class="sqBtnIco_7"></i>删除</a>';
                            }
                        }
                        return d;
                    }
                }
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: 300,
            heightDiff: -2,
            enabledEdit: true,
            isScroll: false,
            checkbox: false,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false,
            enabledSort:false,
            onAfterShowData: function() {
                SetIframe_height ();
            }
        });
        $("#lnkCompNm").ligerComboBox({
            width: 200,
            slide: false,
            selectBoxWidth: 700,
            selectBoxHeight: 450,
            valueField: 'id',
            textField: 'lnkCompNm',
            condition: {fields: [{name: 'lnkCompNm', label: '挂靠公司', width: 90, type: 'text'}]},
            grid: getGridOptions(true),
            conditionSearchClick: function (e) {
                //debugger
                if (e.rules[0] && e.rules[0].value) {
                    e.grid.set('parms', {lnkCompNm: e.rules[0].value});
                } else {
                    e.grid.set('parms', '');
                }
                e.grid.reload();

            },
            onSelected: function (lnkId) {
                console.log('选择的是' + lnkId);
                $('#guarLnkCompId').val(lnkId);
            }
        });
    });
    /* 清空 */
    function clearLnkComp() {
        $('#guarLnkCompId').val('');
        $('#lnkCompNm').val('');
    }

    function getGridOptions(checkbox) {
        var options = {
            columns: [
                {display: '挂靠公司ID', name: 'id', align: 'left', width: 120, minWidth: 60},
                {display: '挂靠公司名称', name: 'lnkCompNm', minWidth: 120, width: 100},
                {display: '审核状态', name: 'audStsCdNm', minWidth: 50, enabledSort: false},
                {
                    display: '是否黑名单', minWidth: 120, enabledSort: false,
                    render: function (rowdata, index, value) {
                        if (!rowdata.isBlackList || rowdata.isBlackList == 0) {
                            return "否";
                        }
                        return "是";
                    }
                }
            ], switchPageSizeApplyComboBox: false,
            url: '<%=path%>/project/prjlnkcomp/initList.do',
            method:'get',
            pageSize: 10,
            root: 'rows',
            record: 'total',
            width: '100%',
            height: '100%'
            //checkbox: checkbox
        };
        return options;
    }

    function add(){
        var form = liger.get("formSet1");
        if (!form.valid()) {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        var data = form.getData();
        data["dataId"] = $("#dataId").val();
        data["splId"]=_splId ;
        var fileParams = upload_result_params;
        var fileParams2 = upload_result_params2;
        if($("#prop9").is(':checked')) {
            var checkFilesResult = checkFiles(fileParams);
            if (checkFilesResult != 1) {
                top.$.ligerDialog.SQalert({content: checkFilesResult, SQ_type: "warning"});
                return false;
            }
        }
        if($("#prop7").is(':checked')) {
            data["packageParams"] = JSON.stringify(splPackageInfoGrid.getData());
            var checkFilesResult2 = checkFiles2(fileParams2);
            if (checkFilesResult2 != 1) {
                top.$.ligerDialog.SQalert({content: checkFilesResult2, SQ_type: "warning"});
                return false;
            }
        }
        data["fileParams"] = JSON.stringify(fileParams);
        data["fileParams2"] = JSON.stringify(fileParams2);
        data["carsGuarId"] = carsGuarId ;
        data["guarLnkCompId"] = $('#guarLnkCompId').val();
        data["noStartFlow"]=_noStartFlow ;
        data["isApply"]=_isApply;
        data["id"]=_id;
        console.log("=data="+JSON.stringify(data));
        var url = '<%=path%>/spl/spepow/addOrModify.do?isFlow='+isFlow ;
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType:'json',
            data:data,
            url: url,
            beforeSend: function(){
                wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
            },
            success:function(msg){
                wait_dialog.close();
                if(msg.success == 1){
                    $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
                    if (_needCloseTab) {
                        setTimeout(function (){
                            var currentTabid = top.mainApp.parentTab.getSelectedTabItemID();
                            top.tab.removeTabItem(currentTabid);
                        }, 1000);
                    }
                    if(msg.data){
                        _id = msg.data ;
                    }
                    fileCfgGrid.setParm("dataId",_id);
                    fileCfgGrid.reload();
                    fileCfgGrid2.reload();
                }else{
                    $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                }
            }
        });
    }
    function disableFiled() {
        if (liger.get("validTmStar")) {
            liger.get("validTmStar").setDisabled(true);
        }
        if (liger.get("validTmEnd")) {
            liger.get("validTmEnd").setDisabled(true);
        }
        if (liger.get("levelCd")) {
            liger.get("levelCd").setDisabled(true);
        }
        $("#clearBtn").hide();
        $("#lnkCompNm").ligerComboBox({ disabled: true });
        if (liger.get("roadBicycleRate")) {
            liger.get("roadBicycleRate").setDisabled(true);
        }
        if (liger.get("stopTruckRate")) {
            liger.get("stopTruckRate").setDisabled(true);
        }
        /*if (liger.get("phaseOneCrAmt")) {
            liger.get("phaseOneCrAmt").setDisabled(true);
        }
        if (liger.get("chnLastYearSlAmt")) {
            liger.get("chnLastYearSlAmt").setDisabled(true);
        }
        if (liger.get("chnLnkAmt")) {
            liger.get("chnLnkAmt").setDisabled(true);
        }*/
    }
    function initData(){
        var _url = '<%=path%>/spl/spepow/initData.do';
        $.ajax({
            type: 'get',
            dataType:'json',
            data:{
                splId : _splId,
                isApply:_isSpePow,
                id:_id
            },
            url: _url,
            success:function(msg){
                if(msg.success == 1){
                    //console.log(JSON.stringify(msg.data));
                    setData(msg.data);//设置数据
                }else{
                    $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                }
            }
        });
    }

    function setData(data){
        if(data){
            if(data.dataList) {
                var dataList = JSON.parse(JSON.stringify(data.dataList));
                if (dataList.length > 0) {
                    for (var i = 0; i < dataList.length; i++) {
                        var s = dataList[i];
                        if(_isShowBigCustomer && _isShowBigCustomer==1){
                            $("#prop" + s + "").ligerGetCheckBoxManager().setValue(true);
                        }else{
                            if(s == 7){
                                continue;
                            }
                            $("#prop" + s + "").ligerGetCheckBoxManager().setValue(true);
                        }
                    }
                    propChange();
                }
            }
            if(data.carsGuar){
                var form = liger.get("formSet1");
                form.setData({
                    levelCd:data.carsGuar.lvlel
                });
                if(data.carsGuar.validTmStar){
                    var date = new Date(data.carsGuar.validTmStar);
                    var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
                    $("#validTmStar").val(dateStr);
                }
                if(data.carsGuar.validTmEnd){
                    var date = new Date(data.carsGuar.validTmEnd);
                    var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
                    $("#validTmEnd").val(dateStr);
                }
                $("#guarLnkCompId").val(data.carsGuar.guarLnkCompId);
                $("#lnkCompNm").val(data.carsGuar.guarLnkCompNm);
                $("#roadBicycleRate").val(data.carsGuar.roadBicycleRate);
                $("#stopTruckRate").val(data.carsGuar.roadBicycleRate);
                $("#phaseOneCrAmt").val(data.carsGuar.phaseOneCrAmt);
                if (data.carsGuar.lvlel === 1) {
                    $("#chnLnkAmtLabel").hide();
                    $("#chnLastYearSlAmtLabel").show();
                    $("#chnLastYearSlAmt").val(data.carsGuar.chnLastYearSlAmt);
                } else if (data.carsGuar.lvlel === 2) {
                    $("#chnLastYearSlAmtLabel").hide();
                    $("#chnLnkAmtLabel").show();
                    $("#chnLnkAmt").val(data.carsGuar.chnLnkAmt);
                } else {
                    $("#chnLnkAmtLabel").hide();
                    $("#chnLastYearSlAmtLabel").hide();
                }
                carsGuarId = data.carsGuar.id ;
            }
            if(data.prjLvlCd){
                var form = liger.get("formSet1");
                form.setData({
                    prjLvlCd:data.prjLvlCd
                });
            }
        }
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value && ''!= value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }
    //全选按钮
    function allChange() {
        console.log("all ==" + $("#ALL")[0].checked);
        if ($("#ALL")[0].checked) {
            $("input[name='prop']").each(function () {
                $(this).ligerGetCheckBoxManager().setValue(true);
            });
        } else {
            $("input[name='prop']").each(function () {
                $(this).ligerGetCheckBoxManager().setValue(false);
            });
        }
        propChange();
    }

    //流程定义key选择动作
    function propChange() {
        var f = true;
        $("input[name='prop']").each(function () {
            if (!$(this)[0].checked) {
                f = false;//有任意一个未选中 f则被赋值为false
            }
        });
        if (f) {
            $("#ALL").ligerGetCheckBoxManager().setValue(true);
        } else {
            $("#ALL").ligerGetCheckBoxManager().setValue(false);
        }
        if($("#prop9").is(':checked')){
            //$("#mes").attr("display","block");
            $("#mes").css("display", 'block');
            $("#levelCd").rules('add',{required:true,select:true});
            $("#validTmStar").rules('add',{required:true});
            $("#validTmEnd").rules('add',{required:true});
            if(_isApply==1){
                $("#roadBicycleRate").rules('add',{required:true});
                $("#stopTruckRate").rules('add',{required:true});
            }
        }else{
            //$("#mes").attr("display",none);
            $("#mes").css("display", 'none');
            $("#levelCd").rules('add',{required:false,select:false});
            $("#validTmStar").rules('add',{required:false});
            $("#validTmEnd").rules('add',{required:false});
            if(_isApply==1){
                $("#roadBicycleRate").rules('add',{required:false});
                $("#stopTruckRate").rules('add',{required:false});
            }
        }
        if($("#prop7").is(':checked') && _isShowBigCustomer == 1){
            $("#mes2").css("display", 'block');
            $("#prjLvlCd").rules('add',{required:true,select:true});
        }else {
            $("#mes2").css("display", 'none');
            if(liger.get("prjLvlCd")) {
                $("#prjLvlCd").rules('add', {required: false, select: false});
            }
        }

    }
    function checkFiles(fileParams) {
        if (fileParams.length <= 0){
            return "请上传附件信息";
        }
        var rows = fileCfgGrid.data.rows;
        var count = {};
        for (var i = 0; i < rows.length; i++) {
            if (rows[i].isMust == 1 && StringUtils.isEmpty(rows[i].fileNm)){
                return "请上传" + rows[i].datNm;
            }
            if (rows[i].maxNum != 0 && rows[i].__status != 'delete'){
                if(count[rows[i].cfgDtlCd]){
                    count[rows[i].cfgDtlCd] += 1;
                } else {
                    count[rows[i].cfgDtlCd] = 1;
                }
            }
        }
        for (var i = 0; i < rows.length; i++) {
            if (rows[i].maxNum != 0) {
                if (rows[i].maxNum < count[rows[i].cfgDtlCd]) {
                    return rows[i].datNm + "不得多于" + rows[i].maxNum + "张";
                }
            }
        }
        return 1;
    }

    function checkFiles2(fileParams) {
        if (fileParams.length <= 0){
            return "请上传附件信息";
        }
        var rows = fileCfgGrid2.data.rows;
        var count = {};
        for (var i = 0; i < rows.length; i++) {
            if (rows[i].isMust == 1 && StringUtils.isEmpty(rows[i].fileNm)){
                return "请上传" + rows[i].datNm;
            }
            if (rows[i].maxNum != 0 && rows[i].__status != 'delete'){
                if(count[rows[i].cfgDtlCd]){
                    count[rows[i].cfgDtlCd] += 1;
                } else {
                    count[rows[i].cfgDtlCd] = 1;
                }
            }
        }
        for (var i = 0; i < rows.length; i++) {
            if (rows[i].maxNum != 0) {
                if (rows[i].maxNum < count[rows[i].cfgDtlCd]) {
                    return rows[i].datNm + "不得多于" + rows[i].maxNum + "张";
                }
            }
        }
        return 1;
    }
    //删除文件
    function delFile(event,_fileId, rowIndex,type){
        top.$.ligerDialog.confirm("确认删除吗?", function (flag) {
            if(!flag){
                return;
            }else{
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: {'fileId':_fileId},
                    url: '<%=path%>/product/splInfo/removeFile.do',
                    beforeSend: function () {
                        wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                    },
                    success: function (msg) {
                        wait_dialog.close();
                        if (msg.success == 1) {
                            var row = fileCfgGrid.getRow(rowIndex);
                            for (var i = 0; i < upload_result_params.length; i++) {
                                if (upload_result_params[i].cfgDtlCd == row.cfgDtlCd && upload_result_params[i].filePath == row.filePath) {
                                    console.log("cfgDtlCd =j= " + row.cfgDtlCd);
                                    upload_result_params.splice(i, 1);
                                    break;
                                }
                            }

                            var gridData = fileCfgGrid.getData();
                            var count = 0;

                            for (var i = 0; i < gridData.length; i++) {
                                if (gridData[i].datNm == row.datNm) {
                                    count++;
                                }
                            }

                            if (count <= 1) {
                                fileCfgGrid.updateCell("filePath", '', rowIndex);
                                fileCfgGrid.updateCell("fileNm", '', rowIndex);
                                fileCfgGrid.updateCell("crtTm", '', rowIndex);
                                fileCfgGrid.updateCell("audStsCdNm", '未验证', rowIndex);
                            } else {
                                fileCfgGrid.deleteRow(rowIndex);
                            }

                            console.log("upload_result_params =k= " + JSON.stringify(upload_result_params));
                        }else{
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                        }
                    }
                });
            }
        });
    }
    function uploadFileByUrl(_url,_name){
        if(SQ.regs.img.test(_name)){
            //SQ.imgPreview(_url);
            //SQ.imgPreview(_url, true);
            window.__ImgSrc = _url;
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }else{
            window.open(_url);
        }
    }
    function onChangefile_multi(e,cfgCd,cfgDtlCd,orgCd) {
        console.log("e == " + JSON.stringify(e));
        var wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
        var filePath= _modulePath; //之前无 '/'
        console.log("filePath ==="+filePath);

        var gridRows = fileCfgGrid.data.rows;
        var count = 1;
        var row ;
        for (var i = 0; i < gridRows.length; i++) {
            if (gridRows[i].cfgDtlCd == cfgDtlCd) {
                row = gridRows[i];
                break;
            }
        }
        for (var i = 0; i < gridRows.length; i++) {
            if (gridRows[i].cfgDtlCd == cfgDtlCd && StringUtils.isNotEmpty(gridRows[i].fileNm)) {
                count ++;
            }
        }
        if (row) {
            if (row.maxNum != 0 && row.maxNum < count) {
                $.ligerDialog.SQalert({content: row.datNm + "最多可上传" + row.maxNum + "份",
                    SQ_showButtons: true,SQ_type: "warning",SQ_onBtnclick:function(){console.log(row.datNm + "最多可上传" + row.maxNum + "份")}});
                wait_dialog.close();
                return ;
            }
        } else {
            $.ligerDialog.SQalert({content: "请刷新页面重试!",
                SQ_showButtons: true,SQ_type: "warning",SQ_onBtnclick:function(){console.log("没有获取到行对象[row]")}});
            wait_dialog.close();
            return ;
        }

        $.ajaxFileUpload({
            url: '<%=path%>/system/sysulfilesrec/upload.do',
            secureuri: false,
            fileElementId: e.target.id,  //这里不在是以前的id了，要写成数组的形式！
            dataType: 'json',
            data: {filePath: filePath,costomerPath:_costomerPath,rootPath:_rootPath,uploadSysCd:_uploadSysCd},
            success: function (msg) {
                if (msg.success == 1) {
                    //var row = fileCfgGrid.getRow(rowIndex);
                    console.log(row);

                    var uploadJOSN = JSON.parse(JSON.stringify(msg.data));
                    console.log("uploadJOSN =s= " + JSON.stringify(uploadJOSN));
                    for (var i=0; i< uploadJOSN.length; i++){
                        var oldPath = "";
                        oldPath = uploadJOSN[i].filePath;
                        if (StringUtils.isEmpty(row.fileNm)) {
                            fileCfgGrid.updateCell("filePath",oldPath,row.__index);
                            fileCfgGrid.updateCell("fileNm",uploadJOSN[i].fileNm,row.__index);
                            fileCfgGrid.updateCell("cfgDtlCd",cfgDtlCd,row.__index);
                            fileCfgGrid.updateCell("crtTm",new Date(),row.__index);
                        } else {
                            var datNm = row.datNm;
                            if (row.isMust == 1) {
                                //datNm += '<span class="requiredSymbol">*</span>';
                            }
                            fileCfgGrid.addRow({
                                audStsCd : 0,
                                audStsCdNm : "未验证",
                                cfgDtlCd : cfgDtlCd,
                                datNm : datNm,
                                isMust : row.isMust,
                                filePath : oldPath,
                                fileNm : uploadJOSN[i].fileNm,
                                crtTm : new Date(),
                            }, row, false)
                        }
                        uploadJOSN[i].cfgCd = _cfgCd ;
                        uploadJOSN[i].cfgDtlCd = cfgDtlCd;
                        uploadJOSN[i].orgCd = _cfgOrgCd;
                        uploadJOSN[i].tabNm = _tabNm;
                        uploadJOSN[i].sysCd = _cfgSysCd;
                        upload_result_params.push(uploadJOSN[i]);
                        console.log("upload_result_params =s= " + JSON.stringify(upload_result_params));
                        console.log("file_btn_val => " + $('#fileup_' + cfgCd + '_' + cfgDtlCd).val());
                        $('#fileup_' + cfgCd + '_' + cfgDtlCd).val('');
                        console.log("file_btn_val => " + $('#fileup_' + cfgCd + '_' + cfgDtlCd).val());
                    }
                    wait_dialog.close();
                } else {
                    wait_dialog.close();
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    };

    //删除文件
    function delUpLoadindFile(event,rowIndex,cfgDtlCd){
        top.$.ligerDialog.confirm("确认删除吗?", function (flag) {
            if(!flag){
                return;
            }else{
                var wait_dialog;
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});

                var row = fileCfgGrid.getRow(rowIndex);

                for (var i=0; i< upload_result_params.length; i++){
                    if(upload_result_params[i].cfgDtlCd == cfgDtlCd && upload_result_params[i].filePath == row.filePath){
                        console.log("cfgDtlCd =j= " + cfgDtlCd);
                        upload_result_params.splice(i,1);
                        break;
                    }
                }

                var gridData = fileCfgGrid.getData();
                var count = 0;

                for (var i = 0; i < gridData.length; i++) {
                    if (gridData[i].datNm == row.datNm) {
                        count ++;
                    }
                }

                if (count <= 1) {
                    fileCfgGrid.updateCell("filePath",'',rowIndex);
                    fileCfgGrid.updateCell("fileNm",'',rowIndex);
                    fileCfgGrid.updateCell("crtTm",'',rowIndex);
                } else {
                    fileCfgGrid.deleteRow(rowIndex);
                }
                console.log("upload_result_params =k= " + JSON.stringify(upload_result_params));
                wait_dialog.close();
            }
        });
    }

    function modifyAudStsCd(event,_fileId,_audStsCd){
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {'fileId':_fileId,'audStsCd':_audStsCd},
            url: '<%=path%>/product/splInfo/modifyFileAudStsCd.do',
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    //$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    event.stopPropagation();
                    var gridID = $(event.target).parents('.sq-grid').attr('ligeruiid');
                    liger.get(gridID).reload();
                }else{
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }



    //删除文件
    function delFile2(event,_fileId, rowIndex,type){
        top.$.ligerDialog.confirm("确认删除吗?", function (flag) {
            if(!flag){
                return;
            }else{
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: {'fileId':_fileId},
                    url: '<%=path%>/product/splInfo/removeFile.do',
                    beforeSend: function () {
                        wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                    },
                    success: function (msg) {
                        wait_dialog.close();
                        if (msg.success == 1) {
                            var row = fileCfgGrid2.getRow(rowIndex);
                            for (var i = 0; i < upload_result_params2.length; i++) {
                                if (upload_result_params2[i].cfgDtlCd == row.cfgDtlCd && upload_result_params2[i].filePath == row.filePath) {
                                    console.log("cfgDtlCd =j= " + row.cfgDtlCd);
                                    upload_result_params2.splice(i, 1);
                                    break;
                                }
                            }

                            var gridData = fileCfgGrid2.getData();
                            var count = 0;

                            for (var i = 0; i < gridData.length; i++) {
                                if (gridData[i].datNm == row.datNm) {
                                    count++;
                                }
                            }

                            if (count <= 1) {
                                fileCfgGrid2.updateCell("filePath", '', rowIndex);
                                fileCfgGrid2.updateCell("fileNm", '', rowIndex);
                                fileCfgGrid2.updateCell("crtTm", '', rowIndex);
                                fileCfgGrid2.updateCell("audStsCdNm", '未验证', rowIndex);
                            } else {
                                fileCfgGrid2.deleteRow(rowIndex);
                            }

                        }else{
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                        }
                    }
                });
            }
        });
    }
    function onChangefile_multi2(e,cfgCd,cfgDtlCd,orgCd) {
        console.log("e == " + JSON.stringify(e));
        var wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
        var filePath= _modulePath2; //之前无 '/'
        console.log("filePath ==="+filePath);

        var gridRows = fileCfgGrid2.data.rows;
        var count = 1;
        var row ;
        for (var i = 0; i < gridRows.length; i++) {
            if (gridRows[i].cfgDtlCd == cfgDtlCd) {
                row = gridRows[i];
                break;
            }
        }
        for (var i = 0; i < gridRows.length; i++) {
            if (gridRows[i].cfgDtlCd == cfgDtlCd && StringUtils.isNotEmpty(gridRows[i].fileNm)) {
                count ++;
            }
        }
        if (row) {
            if (row.maxNum != 0 && row.maxNum < count) {
                $.ligerDialog.SQalert({content: row.datNm + "最多可上传" + row.maxNum + "份",
                    SQ_showButtons: true,SQ_type: "warning",SQ_onBtnclick:function(){console.log(row.datNm + "最多可上传" + row.maxNum + "份")}});
                wait_dialog.close();
                return ;
            }
        } else {
            $.ligerDialog.SQalert({content: "请刷新页面重试!",
                SQ_showButtons: true,SQ_type: "warning",SQ_onBtnclick:function(){console.log("没有获取到行对象[row]")}});
            wait_dialog.close();
            return ;
        }

        $.ajaxFileUpload({
            url: '<%=path%>/system/sysulfilesrec/upload.do',
            secureuri: false,
            fileElementId: e.target.id,  //这里不在是以前的id了，要写成数组的形式！
            dataType: 'json',
            data: {filePath: filePath,costomerPath:_costomerPath2,rootPath:_rootPath2,uploadSysCd:_uploadSysCd2},
            success: function (msg) {
                if (msg.success == 1) {
                    //var row = fileCfgGrid.getRow(rowIndex);
                    console.log(row);

                    var uploadJOSN = JSON.parse(JSON.stringify(msg.data));
                    console.log("uploadJOSN =s= " + JSON.stringify(uploadJOSN));
                    for (var i=0; i< uploadJOSN.length; i++){
                        var oldPath = "";
                        oldPath = uploadJOSN[i].filePath;
                        if (StringUtils.isEmpty(row.fileNm)) {
                            fileCfgGrid2.updateCell("filePath",oldPath,row.__index);
                            fileCfgGrid2.updateCell("fileNm",uploadJOSN[i].fileNm,row.__index);
                            fileCfgGrid2.updateCell("cfgDtlCd",cfgDtlCd,row.__index);
                            fileCfgGrid2.updateCell("crtTm",new Date(),row.__index);
                        } else {
                            var datNm = row.datNm;
                            if (row.isMust == 1) {
                                //datNm += '<span class="requiredSymbol">*</span>';
                            }
                            fileCfgGrid2.addRow({
                                audStsCd : 0,
                                audStsCdNm : "未验证",
                                cfgDtlCd : cfgDtlCd,
                                datNm : datNm,
                                isMust : row.isMust,
                                filePath : oldPath,
                                fileNm : uploadJOSN[i].fileNm,
                                crtTm : new Date(),
                            }, row, false)
                        }
                        uploadJOSN[i].cfgCd = _cfgCd ;
                        uploadJOSN[i].cfgDtlCd = cfgDtlCd;
                        uploadJOSN[i].orgCd = _cfgOrgCd;
                        uploadJOSN[i].tabNm = _tabNm;
                        uploadJOSN[i].sysCd = _cfgSysCd;
                        upload_result_params2.push(uploadJOSN[i]);
                        console.log("upload_result_params2 =s= " + JSON.stringify(upload_result_params2));
                        console.log("file_btn_val => " + $('#fileup_' + cfgCd + '_' + cfgDtlCd).val());
                        $('#fileup_' + cfgCd + '_' + cfgDtlCd).val('');
                        console.log("file_btn_val => " + $('#fileup_' + cfgCd + '_' + cfgDtlCd).val());
                    }
                    wait_dialog.close();
                } else {
                    wait_dialog.close();
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    };

    //删除文件
    function delUpLoadindFile2(event,rowIndex,cfgDtlCd){
        top.$.ligerDialog.confirm("确认删除吗?", function (flag) {
            if(!flag){
                return;
            }else{
                var wait_dialog;
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});

                var row = fileCfgGrid2.getRow(rowIndex);

                for (var i=0; i< upload_result_params2.length; i++){
                    if(upload_result_params2[i].cfgDtlCd == cfgDtlCd && upload_result_params2[i].filePath == row.filePath){
                        console.log("cfgDtlCd =j= " + cfgDtlCd);
                        upload_result_params2.splice(i,1);
                        break;
                    }
                }

                var gridData = fileCfgGrid2.getData();
                var count = 0;

                for (var i = 0; i < gridData.length; i++) {
                    if (gridData[i].datNm == row.datNm) {
                        count ++;
                    }
                }

                if (count <= 1) {
                    fileCfgGrid2.updateCell("filePath",'',rowIndex);
                    fileCfgGrid2.updateCell("fileNm",'',rowIndex);
                    fileCfgGrid2.updateCell("crtTm",'',rowIndex);
                } else {
                    fileCfgGrid2.deleteRow(rowIndex);
                }
                console.log("upload_result_params2 =k= " + JSON.stringify(upload_result_params2));
                wait_dialog.close();
            }
        });
    }
    //联系人新增
    function packageRlAddBtnEvent(){
        splPackageInfoGrid.addRow({
            splPackageNm: '',
            splPackageFirstPct: '',
            splPackageDepositPct: '',
            splPackageIrr: '0',
        });
    };
    function deleteDB(rowdata_id,_id){
        var _url  = '<%=path%>/pspl/spepow/removePackageById.do' ;
        var _ids = [];
        _ids.push(_id);
        $.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
            if(flag == false)return;
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType:'json',
                data:{id:_id},
                url: _url,
                beforeSend: function(){
                    wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING,SQ_type:"waitting"});
                },
                success:function(msg){
                    wait_dialog.close();
                    if(msg.success == 1){
                        $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
                        splPackageInfoGrid.reload();
                    }else{
                        $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                    }
                }
            });
        });
    }
    function deletePage(rowdata_id){
        $.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
            if(flag == false)return;
            splPackageInfoGrid.deleteRow(rowdata_id);
        })
    }


</script>

</body>
</html>
